package view;

import controller.UserController;
import java.util.Scanner;

public class MainView {
    private UserController userController;

    public void setUserController(UserController userController) {
        this.userController = userController;
    }


    public void start() {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("=== CSDN-博客系统 ===");
            System.out.println("1. 注册");
            System.out.println("2. 登录");
            System.out.println("3. 退出");
            System.out.println("请选择操作: ");

            int choice = scanner.nextInt();
            scanner.nextLine(); // 消耗换行符

            switch (choice) {
                case 1:
                    userController.register();
                    break;
                case 2:
                    userController.login();
                    break;
                case 3:
                    System.out.println("退出系统");
                    System.exit(0);
                default:
                    System.out.println("无效的选择，请重新输入");
            }
        }
    }
}
